package com.jack.helloworld.activity;

import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.jack.helloworld.R;

import androidx.appcompat.app.AppCompatActivity;

public class ListActivity extends AppCompatActivity {

    ListView listView;

    ArrayAdapter<String> arrayAdapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_list);

        initView();
        initDate();

    }

    private void initView() {


        listView = (ListView) findViewById(R.id.my_list);


    }

    private void initDate() {
        String[] androidList = new String[]{"Android1", "Android2", "Android3", "Android4"};
        arrayAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, androidList);
        listView.setAdapter(arrayAdapter);

    }
}
